package com.zengde.ai_sandbox.config;

import com.zengde.ai_sandbox.service.SuperBigModelInterface;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 模型服务配置
 * 集中管理所有大模型服务
 */
@Configuration
public class ModelServiceConfig {
    
    /**
     * 注入所有实现了SuperBigModelInterface的服务
     * 通过它们的名称（例如 "doubaoService"）进行管理
     */
    @Bean
    public Map<String, SuperBigModelInterface> modelServices(List<SuperBigModelInterface> services) {
        Map<String, SuperBigModelInterface> serviceMap = new HashMap<>();
        
        for (SuperBigModelInterface service : services) {
            // 获取服务类上的@Service("name")注解中的name
            String beanName = service.getClass().getAnnotation(org.springframework.stereotype.Service.class).value();
            serviceMap.put(beanName, service);
        }
        
        return serviceMap;
    }
} 